package com.example.system.controller.user;

import com.example.common.core.controller.BaseController;
import com.example.common.core.domain.R;
import com.example.common.core.domain.TableDataInfo;
import com.example.system.domain.user.dto.UserDTO;
import com.example.system.domain.user.dto.UserQueryDTO;
import com.example.system.domain.user.vo.UserVO;
import com.example.system.service.user.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController extends BaseController {

    @Autowired
    private IUserService userService;

    @GetMapping("/list")
    public TableDataInfo list(UserQueryDTO userQueryDTO) {
        List<UserVO> userVOList = userService.list(userQueryDTO);
        return getTableDataInfo(userVOList);
    }

    /**
     * 拉黑:限制用户操作
     * 解禁:放开对用户的限制
     * 更新数据库用户状态信息
     * @param userDTO
     * @return
     */
    @PutMapping("/updateStatus")
    public R<Void> updateStatus(@RequestBody UserDTO userDTO) {
        int result = userService.updateStatus(userDTO);
        return toR(result);
    }





}
